[HVM][SVM] Check if SVM is disabled by the BIOS before enabling it.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 12 Oct 2006 15:12:10 +0000 (16:12 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 12 Oct 2006 15:12:10 +0000 (16:12 +0100)
Newer BIOS implementations will be able to disable the SVM feature,
although an additional test of an MSR  (VMCR 0xC0010114 bit 4) is
necessary (set equals disabled).  Bit 4 of MSR 0xc0010114 returns 0
(SVM enabled) on machines with older BIOS' without the SVM disable
feature support.

Signed-off-by: Wei Huang <wei.huang2@amd.com>=20
Signed-off-by: Tom Woller <thomas.woller@amd.com>=20
xen/arch/x86/hvm/svm/svm.c

index 6d67980af4588e097e7a29fd07f68886149aa260..ca4f8d52ae0dac4f975048cce98fd48630404605 100644 (file)
@@ -840,6 +840,13 @@ int start_svm(void)
     
     if (!(test_bit(X86_FEATURE_SVME, &boot_cpu_data.x86_capability)))
         return 0;
+
+    /* check whether SVM feature is disabled in BIOS */
+    rdmsr(0xC0010114, eax, edx);
+    if ( eax & 0x00000010 ) {
+        printk("AMD SVM Extension is disabled in BIOS.\n");
+        return 0;
+    }
     
     if (!(hsa[cpu] = alloc_host_save_area()))
         return 0;